package com.gamex.findit.util;

import org.apache.commons.lang.ArrayUtils;
import com.mysql.jdbc.StringUtils;

public class Base64 {
    public static String encodeBase64String(byte[] binaryData) {
    	if(ArrayUtils.isEmpty(binaryData)) return null;
    	return new String(org.apache.commons.codec.binary.Base64.encodeBase64(binaryData));
    }
    
    public static byte[] decodeBase64(String base64String) {
    	if(StringUtils.isNullOrEmpty(base64String)) return null;
    	return org.apache.commons.codec.binary.Base64.decodeBase64(base64String.getBytes());
    }
    
    public static byte[] decodeBase64(byte[] base64) {
    	if(ArrayUtils.isEmpty(base64)) return null;
    	return org.apache.commons.codec.binary.Base64.decodeBase64(base64);
    }
}
